project(Tests)
cmake_minimum_required(VERSION 2.8)

set(CMAKE_BUILD_TYPE "Debug")

if(UNIX)
    add_definitions( "-Wall -std=c++11" )
endif()

add_subdirectory(LinearProgramming)
add_subdirectory(MatrixCoreTestUtility)

####### Required Libraries ########################
set(EIGEN_INC "" CACHE PATH "Eigen Include Directory")
set(BOOST_INC "" CACHE PATH "Boost Lib Include Directory")
set(GTEST_INC "" CACHE PATH "Google Test Include Directory")
set(GMOCK_INC "" CACHE PATH "Google Mock Include Directory")

set(GTEST_OBJ "" CACHE PATH "Google Test Objects Directory")
set(GMOCK_OBJ "" CACHE PATH "Google Mock Objects Directory")
####### Required Libraries ########################

include_directories(SYSTEM ${EIGEN_INC})
include_directories(SYSTEM ${BOOST_INC})
include_directories(SYSTEM ${GTEST_INC})
include_directories(SYSTEM ${GMOCK_INC})

include_directories(.)
include_directories(SYSTEM ..)

#Actual extensions are included in below header, leaving orginal code untouched
add_definitions(-DEIGEN_SPARSEVECTOR_PLUGIN="MatrixCoreTestUtility/SparseVectorAddonsForTesting.hpp")

find_library(GTEST NAMES gtest
                   PATHS ${GTEST_OBJ}
                   PATH_SUFFIXES debug)

find_library(GMOCK NAMES gmock
                   PATHS ${GMOCK_OBJ}
                   PATH_SUFFIXES debug)

aux_source_directory(. SRC_LIST)

#TODO CMAKE says this is not recomended way (Using GLOB)
file(GLOB LP_T_HEADERS "LinearProgramming/*.hpp")
file(GLOB MC_T_HEADERS "MatrixCoreTestUtility/*.hpp")


#Remove
include_directories(SYSTEM "/usr/local/include")

find_library(CHOLMOD_LIBRARIES cholmod PATHS ${LIB_INSTALL_DIR})
find_library(AMD_LIBRARY amd PATHS ${LIB_INSTALL_DIR})
find_library(COLAMD_LIBRARY colamd PATHS ${LIB_INSTALL_DIR})
find_library(CAMD_LIBRARY camd PATHS ${LIB_INSTALL_DIR})
find_library(CCOLAMD_LIBRARY ccolamd PATHS ${LIB_INSTALL_DIR})

find_library(CHOLMOD_METIS_LIBRARY metis PATHS "/home/satya/ThirdParty/metis-4.0.3")
find_library(SPQR_LIBRARY spqr PATHS ${LIB_INSTALL_DIR})

find_library(SUITESPARSE_C_LIBRARY suitesparseconfig PATHS ${LIB_INSTALL_DIR})

find_library(LAPACK_LIBRARY lapack PATHS ${LIB_INSTALL_DIR})
find_library(BLAS_LIBRARY blas PATHS ${LIB_INSTALL_DIR})
#Remove

add_executable(${PROJECT_NAME} ${SRC_LIST} ${LP_T_HEADERS} ${MC_T_HEADERS})


#Remove
target_link_libraries(${PROJECT_NAME}
                      ${SPQR_LIBRARY}
                      ${SUITESPARSE_C_LIBRARY}
                      ${CHOLMOD_LIBRARIES}
                      ${AMD_LIBRARY} ${COLAMD_LIBRARY} ${CAMD_LIBRARY} ${CCOLAMD_LIBRARY}
                      ${CHOLMOD_METIS_LIBRARY}
                      ${LAPACK_LIBRARY} ${BLAS_LIBRARY}
                      gfortran  )
#Remove

target_link_libraries(${PROJECT_NAME} ${GTEST} ${GMOCK} pthread)

